home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************************
- *
- *
- * MacZoop - "the framework for the rest of us"
- *
- *
- *
- * ZPlugInHandler.h -- an object for managing plug-ins
- *
- *
- *
- *
- *
- * © 1997, Graham Cox
- *
- *
- *
- *
- *************************************************************************************************/
-
- #pragma once
-
- #ifndef __ZPLUGINHANDLER__
- #define __ZPLUGINHANDLER__
-
-
- #include "ZFolderScanner.h"
- #include "ZPlugIn.h"
- #include "ZObjectArray.h"
-
-
-
- typedef ZObjectArray<ZPlugIn> ZPlugInList;
-
-
-
- class ZPlugInHandler : public ZFolderScanner
- {
- protected:
- ZPlugInList* itsPlugIns;
-
- public:
-
- ZPlugInHandler( const FSSpec& rootFolder );
- ~ZPlugInHandler();
-
- virtual void InitPlugIns();
- virtual void SendMessageToPlugIn( const short plugID, const long message, void* msgData );
- virtual void SendMessageToAll( const long message, void* msgData );
- virtual void BuildMenuOfPlugIns( MenuHandle aMenu );
- virtual short CountPlugIns() { return itsPlugIns->CountItems(); };
-
- protected:
- virtual void Process1File( const FSSpec& aSpec, const OSType fType );
- virtual ZPlugIn* MakePlugIn( const FSSpec& aSpec, const OSType fType );
- };
-
-
- // this object is part of a generalised plug-in architecture. It is based on ZFolderScanner
- // and what is expected is that valid plug-ins will reside in some folder or a hierarchy of
- // folders. As each plug-in file is passed to Process1File, this will create a plug-in object
- // and keep it in its list of plug-ins. You need to override MakePlugIn to make the correct
- // type of ZPlugIn object (since ZPlugIn itself is an abstract class that does nothing).
-
- // normally you'll make one of these as a global object as part of building your application.
- // You then need to call InitPlugIns at some point to kick off the scan for plug-ins.
-
- // The responsibility for establishing a user-interface to access the plug-ins is entirely
- // yours- this provides a single simple method for building a menu of plug-ins but handling
- // this menu is your responsibility. It is not recommended that a menu of plug-ins is the
- // best way to implement a user-interface, though it may be appropriate for simple uses.
-
-
- #endif